package cn.stylefeng.guns.modular.business.frequency.transportlevel.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.transportlevel.service.TransportLevelService;
import cn.stylefeng.guns.modular.business.frequency.transportlevel.model.param.TransportLevelParam;

import javax.annotation.Resource;

/**
 * 运单运输车辆详情 控制器
 *
 * @author: yujie
 * @date: 2023/05/09 17:15
 */
@RestController
public class TransportLevelController {

    @Resource
    private TransportLevelService transportLevelService;

    /**
     * 分页查询运单运输车辆详情
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @GetMapping("/transportLevel/page")
    @BusinessLog(title = "运单运输车辆详情_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(TransportLevelParam transportLevelParam) {
        return new SuccessResponseData(transportLevelService.page(transportLevelParam));
    }

    /**
     * 获取全部运单运输车辆详情
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @GetMapping("/transportLevel/list")
    @BusinessLog(title = "运单运输车辆详情_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(TransportLevelParam transportLevelParam) {
        return new SuccessResponseData(transportLevelService.list(transportLevelParam));
    }

    /**
     * 查看详情运单运输车辆详情
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @GetMapping("/transportLevel/detail")
    @BusinessLog(title = "运单运输车辆详情_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(TransportLevelParam.detail.class) TransportLevelParam transportLevelParam) {
        return new SuccessResponseData(transportLevelService.detail(transportLevelParam));
    }

    /**
     * 添加运单运输车辆详情
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @PostMapping("/transportLevel/add")
    @BusinessLog(title = "运单运输车辆详情_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(TransportLevelParam.add.class) TransportLevelParam transportLevelParam) {
        transportLevelService.add(transportLevelParam);
        return new SuccessResponseData();
    }

    /**
     * 删除运单运输车辆详情
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @PostMapping("/transportLevel/delete")
    @BusinessLog(title = "运单运输车辆详情_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(TransportLevelParam.delete.class) TransportLevelParam transportLevelParam) {
        transportLevelService.delete(transportLevelParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑运单运输车辆详情
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @PostMapping("/transportLevel/edit")
    @BusinessLog(title = "运单运输车辆详情_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(TransportLevelParam.edit.class) TransportLevelParam transportLevelParam) {
        transportLevelService.edit(transportLevelParam);
        return new SuccessResponseData();
    }


}
